package com.example.class_manage.Mapper;

import com.example.class_manage.Entity.question_pic;
import com.example.class_manage.Entity.question_text;
import com.example.class_manage.Entity.serial_homework;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper//上传问题查看问题
public interface All_HomeworkQuestion {
    @Select("select * from serial_homework where Id = #{id}")
//作业号
    serial_homework Get_Homework_Byid(String id);

    @Select("select * from serial_homeworkpic where teacher_Id = #{teacher_Id}")//作业号
    List<serial_homework> Get_teacher_Allhomework_pic(String teacher_Id);

    @Select("select * from serial_homeworktext where teacher_Id = #{teacher_Id}")//作业号
    List<serial_homework> Get_teacher_Allhomework_text(String teacher_Id);

    @Update("insert into serial_homeworktext (Id, teacher_Id, `describe`, Time) VALUES (#{Id},#{teacher_Id},#{describe},#{Time})")
    Integer Uprecord_homework_text(String Id, String teacher_Id, String describe, String Time);

    @Update("insert into serial_homeworkpic (Id, teacher_Id, `describe`, Time) VALUES (#{Id},#{teacher_Id},#{describe},#{Time})")
    Integer Uprecord_homework_pic(String Id, String teacher_Id, String describe, String Time);

    @Insert("insert into question_pic (Id, `describe`, pic, submit, sclass, stu_id) VALUES (#{id},#{describe},#{pic},#{submit},#{sclass},#{stu_id})")
    Integer insert_question_pic_bysclass(String id, String describe, byte pic[], String submit, String sclass, String stu_id);

    @Insert("insert into question_text (Id, `describe`, pic, submit, sclass, stu_id) VALUES (#{id},#{describe},#{pic},#{submit},#{sclass},#{stu_id})")
    void insert_question_text_bysclass(String id, String describe, byte[] pic, String submit, String sclass, String stu_id);

    @Select("select * from question_pic where stu_id=#{stu_id} and submit = '0' ")
    List<question_pic> Find_Question_pic(String stu_id);

    @Select("select * from question_text where stu_id=#{stu_id} and submit = '0'")
    List<question_text> Find_Question_text(String stu_id);

    @Update("update question_pic set submit = '1' where stu_id = #{stu_id} and id = #{id}")
    Integer UpdateSubmit_pic(String stu_id, String id);

    @Update("update question_text set submit = '1' where stu_id = #{stu_id} and id = #{id}")
    Integer UpdateSubmit_text(String stu_id, String id);

}
